<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org"
                xmlns:sec="http://www.thymeleaf.org/extras/spring-security">
<!--<html lang="en" >-->
<head>
    <meta charset="UTF-8">
    <title>首页</title>
</head>
<body>


<div sec:authorize="!isAuthenticated()">
    <a th:href="@{/user/login}" > 登录 </a>
</div>

<div sec:authorize="isAuthenticated()">
    用户名：<span sec:authentication="name"></span>
    <a th:href="@{/logout}" > 注销 </a>
</div>

首页

<br>
<div sec:authorize="hasRole('USER')">
    <a th:href="@{/page/page01}" > page01 </a>
    <a th:href="@{/page/page02}" > page02 </a>
</div>
<br>
<div sec:authorize="hasAnyRole('USER','YOUKE')">
    <a th:href="@{/info/info01}" > info01 </a>
</div>



</body>
</html>